<%@ page pageEncoding="utf-8"%>
<%@page import="java.util.Map"%>
<%@page import="org.json.JSONObject"%>
<%@page import="java.util.List"%>
<%@page import="org.json.JSONArray"%>
<%@page import="org.personal.entity.Page"%>
<%@page import="org.personal.entity.Layout"%>
<%@page import="org.personal.entity.User"%>
<%@page import="org.personal.Constants"%>
<%
String path_portlets = request.getContextPath();
String basePath_portlets = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path_portlets+"/";

String pageId=request.getParameter("pageId");
Page pageObject=(Page)request.getAttribute(Constants.PAGE);
Layout layoutObject=(Layout)request.getAttribute(Constants.LAYOUT);
User user=(User)request.getSession().getAttribute(Constants.USER);
List portlets=(List)request.getAttribute(Constants.PORTLETS);
boolean editable=(Boolean)request.getAttribute(Constants.EDITABLE);
JSONArray pts=(JSONArray)JSONObject.wrap(portlets);
String layout="";
if(layoutObject!=null)
{
   	layout=layoutObject.getHtml();
}
request.setAttribute(Constants.LAYOUT,layout);
request.setAttribute("pageId",pageId);
%>
<script type="text/javascript" src="<%=basePath_portlets%>js/doRequest.js"></script>
<script type="text/javascript" src="<%=basePath_portlets%>js/addOnLoad.js"></script>
<script type="text/javascript" src="<%=basePath_portlets%>js/addKeyDown.js"></script>

<script type="text/javascript" src="<%=basePath_portlets%>jquery/portlets/jquery.js"></script>
<script type="text/javascript" src="<%=basePath_portlets%>jquery/portlets/interface.js"></script>
<script type="text/javascript" src="<%=basePath_portlets%>jquery/portlets/config2.js"></script>
<script type="text/javascript" src="<%=basePath_portlets%>jquery/portlets/portlet.js"></script>
<script type="text/javascript" src="<%=basePath_portlets%>jquery/portlets/node.js"></script>
<link href="<%=basePath_portlets%>jquery/portlets/portlets.css" rel="stylesheet" type="text/css" />

<script>
var containerMap=new Object();
var portlets=<%=pts%>;
var portletArray=new Array();
var portletMap=new Object();
var requestCount=0;
var basePath_portlets="<%=basePath_portlets%>";
var editable=<%=editable%>;
function get(id){return document.getElementById(id);}
function getPageId(){return "<%=request.getParameter("pageId")%>";}
function getEditable(){return editable;}

</script> 
<%if(editable){%>
<script type="text/javascript" src="<%=basePath_portlets%>jquery/portlets/page.js"></script>
<%}%>
<%if(editable){%>
<style>
.portlet_topper {
   cursor: move;
}
</style>	
<%}%>

